#!/bin/bash

if [ -z "$GCLOUD_SERVICE_KEY" ]
then
  echo "Skipping report generation because no gcloud service key is set"
  exit 0
else
  mkdir -p coverage
  gsutil rsync gs://codeclimate-aggregation/${CIRCLE_WORKFLOW_ID} coverage
  cc-test-reporter sum-coverage coverage/codeclimate.*.json
  cc-test-reporter upload-coverage
fi
